<template>
	<view>
		
		<view class="content">
			<view class="kinds" v-for="(item , index) in classList" :key="index" v-if="index<3" @click="search(item.type_id)">
				<text clas="title">{{item.label}}</text>
				<text class="subTitle">{{item.name}}</text>
				<image :src="qiniu+item.image_id" mode="aspectFit"></image>
			</view>
		</view>
		<view class="content">
			<view class="kinds" v-for="(item , index) in classList" :key="index" v-if="index>=3" @click="search(item.type_id)">
				<text clas="title">{{item.label}}</text>
				<text class="subTitle">{{item.name}}</text>
				<image :src="qiniu+item.image_id" mode="aspectFit"></image>
			</view>
		</view>
			<!-- <view class="scroll_box"> 
			  <scroll-view class="scroll-view_x" :scroll-top="scrollTop" scroll-x="true" @scroll="scroll">
			<view class="scroll" v-for="(item , index) in goodsShow" :key="index" v-if="index>=3">
				<text style="font-size:40upx;">{{item.title}}</text>
				<text >{{item.subTitle}}</text>
				<image :src="item.img" mode=""></image>
			</view>
			</scroll-view>
		</view> -->	
		</view>
		
</template>

<script>
	import eonfox from "@/components/eonfox/eonfox.js"
	import fns from '@/components/eonfox/fns.js';
	var ef = new eonfox();
	export default {
		name: "GoodsShow",
		data() {
			return {
				 scrollTop: 0,
				old: {
				    scrollTop: 0
				},
				classList:[],
				qiniu:''
			};
		},
		onLoad() {
			var _this=this;
			ef.submit({
				request:{
					a:['APPLICATIONTYPEOPTION',[{module:"shop_goods_type","label":"APP首页专区"}]],//分类菜单
					config: ['APPLICATIONCONFIG']
				},
				callback(data){
					var dataList = fns.checkError(data,[]);
					if( !dataList ){
						return false;
					}
					console.log("//专区",dataList.a);
					if( dataList.a ){
						/* var typeSonList = [];
						
						for( var i in dataList.a ){
							if( dataList.a[i].son ){
								typeSonList = typeSonList.concat(dataList.a[i].son);
							}
						} */
						if( dataList.a[0] && dataList.a[0].son ){
							_this.classList = dataList.a[0].son;
						}
					}
					if( dataList.config && dataList.config.qiniu_domain){
						_this.qiniu = dataList.config.qiniu_domain;
					}
				},
				})
		},
		methods:{
			search(id){
				uni.navigateTo({
					url:'../../pagesB/search-result/search-result?id='+id
				})
			},
			scroll: function(e) {
			    this.old.scrollTop = e.detail.scrollTop
			},
			goTop: function(e) {
			    this.scrollTop = this.old.scrollTop
			    this.$nextTick(function() {
			        this.scrollTop = 0
			    });
			},
		}
	}
</script>

<style scoped lang="stylus" ref="stylesheet/stylus">
	.content
		display flex
		flex-direction row
		width 100%
		margin-bottom 40upx
		
		.kinds
			width 32.5%
			height 300upx
			text-align center
			
			.title
				display block
				font-size 40upx
				font-weight 600
			.subTitle
				display block
				font-size 24upx
				margin 10upx 0 40upx
			image
				width 210upx
				height 150upx
				border-radius 10upx
		
		
</style>
<style>
	  .scroll_box{
	width: 100%;
	height: 307upx;
	overflow: hidden;
	white-space: nowrap;
	}
	.scroll{
	text-align:center;
	border-right: 1px solid #d2d2d2;
	border-bottom :1px solid #d2d2d;
	width: 290upx;
	height: 307upx;
	display: inline-block;
	font-size: 28upx;
	}
	.scroll image{
		float: left;
		width: 150upx;
		height:150upx;
		margin-left:50upx;
		margin-top: 25upx;
	}
	.scroll text{
		margin-top: 5upx;
		margin-bottom: 5upx;
		float: left;
		width: 100%;
		text-align: center;
	}
	
</style>